1. Field of the Invention
The present invention generally relates to paging techniques in computer systems. More specifically, the present invention relates to paging techniques that facilitate adaptive page sizes.
2. Related Art
Modern computer operating systems allocate memory to programs in small blocks called “pages.” Pages are moved into and out of random-access memory through a process which is referred to as “paging.” Paging mechanisms enable a program and its associated data to be split across non-contiguous memory, which reduces memory fragmentation. Paging combined with virtual memory techniques allow a virtual address space to exceed the physical memory size, and also allows the system to present separate virtual address spaces to different programs or program segments.
Paging is typically implemented by using a contiguous page table to keep track of virtual memory pages. Note that the page table size is inversely proportional to page size, since as the page size increases there are fewer page table entries. Note also that mapping a virtual address to a physical address typically involves multiple levels of indirection, which results in multiple memory references prior to accessing actual data. A translation look-aside buffer (TLB) can be used to cache recently-translated addresses to speed up this translation process.
Page size plays an important role in overall system behavior and performance. Since the size of the page table is inversely related to the page size, larger pages reduce both page table and TLB overheads and result in higher TLB hit rates. On the other hand, larger pages can induce additional data sharing among processes, and can consequently incur higher data coherence overhead. Since all existing paging schemes use either a single fixed page size for the entire system or a very small number of selectable page sizes which can only be manually set for a process and remain unchanged throughout the process' execution, choosing an optimal page size that suites a wide range of applications can be a difficult task.
Hence, what is needed is a method and an apparatus for alleviating some of the above-described problems with paging.